package com.example.controll.reserve;

import com.example.config.R;
import com.example.domain.reserve;
import com.example.service.reserve.reserveService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/reserve")
public class reserveCotroll {

    @Resource
    private reserveService reserveService;

    @RequestMapping("/insert")
    private R insertDD(reserve reserve){
        boolean flag=reserveService.insert(reserve);
        return new R(flag,flag?"添加成功":"添加失败");
    }

    @RequestMapping("/deleteOne")
    private R deleteOne(String user_openid,int articlesid){
        user_openid="'"+user_openid+"'";
        boolean flag=reserveService.delete(user_openid,articlesid);
        return new R(flag,flag?"删除成功":"删除失败");
    }


    @RequestMapping("/deleteAll")
    private R deleteAll(String user_openid){
        user_openid="'"+user_openid+"'";
        boolean flag=reserveService.delete(user_openid);
        return new R(flag,flag?"删除成功":"删除失败");
    }


}
